import gym, roboschool, sys
import numpy as np

def relu(x):
    return np.maximum(x, 0)

class SmallReactivePolicy:
    "Simple multi-layer perceptron policy, no internal state"
    def __init__(self, ob_space, ac_space):
        assert weights_dense1_w.shape == (ob_space.shape[0], 64)
        assert weights_dense2_w.shape == (64, 32)
        assert weights_final_w.shape  == (32, ac_space.shape[0])

    def act(self, ob):
        x = ob
        x = relu(np.dot(x, weights_dense1_w) + weights_dense1_b)
        x = relu(np.dot(x, weights_dense2_w) + weights_dense2_b)
        x = np.dot(x, weights_final_w) + weights_final_b
        return x

def demo_run():
    env = gym.make("RoboschoolPong-v1")
    if len(sys.argv)==3: env.unwrapped.multiplayer(env, sys.argv[1], player_n=int(sys.argv[2]))

    pi = SmallReactivePolicy(env.observation_space, env.action_space)

    while 1:
        frame = 0
        score = 0
        restart_delay = 0
        obs = env.reset()

        while 1:
            a = pi.act(obs)
            obs, r, done, _ = env.step(a)
            score += r
            frame += 1
            still_open = env.render("human")
            if still_open==False:
                return
            if not done: continue
            if restart_delay==0:
                print("score=%0.2f in %i frames" % (score, frame))
                if still_open!=True:      # not True in multiplayer or non-Roboschool environment
                    break
                restart_delay = 60*2  # 2 sec at 60 fps
            restart_delay -= 1
            if restart_delay==0: break

weights_dense1_w = np.array([
[ +0.4231, -0.1260, -0.4414, -0.4028, -0.1991, -0.5320, -0.2615, -0.5119, -0.6858, +0.0253, +0.2646, +0.7722, +0.0711, -0.0822, +0.0709, +0.1407, +0.1546, +0.0755, +0.0522, +0.1687, +0.1017, -0.2217, +0.0180, -0.5547, +0.5731, +0.4167, -0.0525, +0.1758, +0.0647, +0.0541, -0.0524, +0.1389, +0.2171, -0.0666, +0.0451, +0.1458, -0.1149, -0.1684, +0.4064, -0.6432, -0.1740, -0.0011, +0.5321, +0.1257, -0.2954, +0.2497, +0.1504, -0.0838, -0.1513, +0.1727, -0.0214, -0.2173, -0.4360, -0.0156, -0.2355, +0.1505, +0.1588, -0.3765, -0.0768, +0.2158, -0.0798, +0.2429, +0.5058, +0.1144],
[ +0.2898, -0.3957, +0.1187, +0.4169, -0.0602, -0.2780, -0.3090, +0.2115, +0.1666, -0.1594, -0.2255, -0.0039, -0.4512, +0.2020, -0.3627, -0.4204, +0.5935, +0.1515, +0.0370, -0.1580, +0.1815, +0.2672, +0.3136, +0.0487, +0.0738, +0.1940, +0.6009, +0.2707, +0.3643, +0.1616, +0.4710, +0.6505, +0.4301, -0.2719, +0.1092, +0.0855, -0.4694, -0.7201, -0.1967, +0.1674, +0.2831, -0.0496, -0.3852, -0.9972, -0.0093, -0.0858, +0.1316, +0.5199, -0.1840, +0.0277, -0.0846, +0.1313, -0.1912, -0.7514, +0.4413, +0.2014, +0.3816, -0.2621, -0.6938, -0.1576, -0.4821, -0.3766, -0.4559, +0.2470],
[ +0.1057, -0.1922, +0.8866, -0.4590, -0.1751, +0.2700, +0.3241, +0.1508, -0.4771, -0.4793, +0.1726, -0.1830, +0.7265, -0.1520, +0.6837, +0.9429, +0.0347, +0.6212, -0.4343, -0.8756, -0.3924, -0.0987, -1.0836, -0.7286, -0.3353, +0.3667, -0.4509, -0.7713, +0.5258, +0.0183, -0.1579, -0.0090, +0.3378, -0.7528, +0.6440, +0.9249, -0.2207, -0.4928, -0.5111, +0.5788, +0.0227, +0.7035, +0.1093, +0.0405, +0.3430, +0.3313, +0.5169, +0.8728, -0.5773, +0.0787, -0.9406, -0.0910, +0.0091, -0.0641, -0.5051, +0.4231, +0.6051, -0.4749, +0.4885, -0.0354, +1.0120, -0.0655, +0.0290, -0.5385],
[ -0.6339, -0.1613, -0.6777, +0.0997, -0.1740, -0.3997, -0.0587, +0.1077, -0.7837, -0.1567, -0.1798, -0.0474, +0.1445, +0.0343, -0.5656, +0.1777, +0.3324, -0.4490, +0.1424, +0.1270, -0.0964, -0.2619, +0.1567, -0.1805, -0.2796, +0.1709, -0.4196, +0.0559, +0.4723, +0.6496, -0.6426, +0.4161, +0.0443, +0.1663, -0.1739, -0.0919, +0.0691, -0.5813, -0.2664, +0.2284, +0.1161, -0.2669, +0.1793, -0.0127, +0.0076, -0.2221, +0.1606, -0.2511, -0.2395, +0.0212, +0.0347, -0.4155, +0.3239, -0.0506, -0.4540, -0.3164, +0.4469, -0.2900, -0.2483, -0.2870, -0.0837, +0.0716, +0.3843, +0.0890],
[ +0.4428, +0.0931, -0.0404, +0.2289, -0.0384, +0.5723, +0.3159, -0.3465, +0.0899, +0.1699, +0.1247, +0.1932, +0.1974, -0.2964, -0.2977, -0.0073, -0.3640, -0.2491, +0.0655, +0.2312, -0.3846, +0.0139, +0.0583, +0.2344, +0.0454, -0.5522, -0.0663, -0.1305, +0.1406, -0.1440, -0.3751, +0.0856, -0.3176, -0.1920, -0.1768, -0.0441, +0.3610, +0.2481, -0.3468, +0.3347, -0.0395, -0.2355, +0.4171, -0.5151, -0.4218, +0.3227, +0.2654, +0.2650, +0.5049, +0.2835, +0.2377, +0.2090, -0.7111, -0.5745, -0.1374, +0.3172, -0.2061, -0.2416, +0.0766, +0.0375, +0.1519, -0.0079, +0.4752, -0.1764],
[ -0.5779, -0.8907, -0.0796, +0.0091, +0.3148, +0.1261, -0.4494, -0.3311, +0.0773, -1.0167, -0.0555, +0.0081, +0.2184, -0.0395, +0.3441, +0.0166, +0.1571, +0.0735, +0.0828, +0.0930, +0.4143, -0.4271, +0.0028, -0.6446, +0.3848, +0.1099, -0.2670, -0.0819, -0.4316, -0.3086, -0.0431, -0.1330, -0.1442, -0.4427, +0.4089, -0.3550, +0.0579, -0.3314, +0.3079, -0.1259, -0.0864, -0.2166, +0.4510, -0.3360, +0.4475, +0.2935, +0.5816, -0.3465, -0.0684, +0.0295, +0.1773, +0.0162, +0.5706, -0.2440, +0.2163, -0.1493, +0.0682, +0.0938, -0.2844, -0.1644, +0.1793, -0.2344, -0.2468, -0.3323],
[ +0.4155, +0.0246, -0.2521, -0.4373, +0.4434, -0.2098, +0.1860, -0.2861, +0.5067, +0.2209, +0.4908, +0.4427, +0.5569, -0.5627, -0.3265, +0.2534, +0.5487, -0.0335, +0.0668, +0.4599, +0.0165, +0.0099, -0.1573, +0.1116, +0.5107, -0.1235, -0.0799, -0.0664, -0.0290, +0.2743, -0.5150, +0.1297, +0.1573, -0.3584, +0.3134, -0.3470, -0.6832, +0.4671, +0.1756, -0.0064, +0.3199, +0.2185, -0.0667, -0.0745, +0.6360, +0.2930, -0.4689, +0.1044, +0.0442, +0.7311, -0.0553, +0.1238, +0.0559, -0.1398, -0.1215, +0.6281, -0.0978, +0.3053, -0.4188, +0.6612, -0.1931, -0.0680, -0.0432, -0.6521],
[ -0.1903, +0.5477, -0.1402, +0.2145, -0.1055, +0.2604, +0.5417, -0.2006, +0.3724, -0.0355, -0.4664, -0.1228, +0.1939, -0.1284, +0.1356, -0.4969, -0.3243, -0.5947, -0.0357, +0.0344, +0.0291, -0.0390, +0.2989, +0.2727, +0.1598, -0.5754, -0.1143, +0.1692, +0.1113, -0.1263, -0.0198, +0.1649, +0.0996, -0.0475, -0.0042, +0.0031, +0.0107, +0.0171, -0.2314, +0.2684, -0.0289, +0.1505, -0.4189, +0.0810, -0.0335, +0.1105, +0.1899, +0.3756, +0.1353, +0.2959, -0.4083, -0.0933, +0.0348, -0.1517, -0.2341, -0.2091, +0.1613, -0.3210, +0.1317, +0.1562, +0.1445, +0.0134, -0.2458, +0.1922],
[ +0.5998, -0.1158, -0.5013, -0.4391, +0.4305, -0.3907, +0.5771, -0.0970, +0.3632, -0.1602, +0.2323, -0.7595, +0.1617, +0.5596, -0.3879, +0.3121, +0.1754, +0.3481, +0.3725, +0.3765, -0.0953, -0.6187, -0.8097, +0.2146, -0.2064, -0.7110, -0.2842, -0.4461, -0.6511, +0.7377, +0.7654, -0.4286, +0.1029, +0.1905, -0.5883, -0.2421, +0.4443, -0.6318, -0.1407, +0.7153, -0.9163, +0.5425, +0.2954, -0.3016, +0.1308, -0.3518, -0.3073, -0.3187, -0.4732, +1.2551, -0.2534, -1.1775, -0.1763, -0.3098, +0.2833, -0.0511, -0.2499, -0.7165, -0.1025, -0.9377, +0.1240, -0.4735, -0.1186, +0.2413],
[ +0.1553, +0.2954, -0.1219, -0.0553, -0.3648, +0.1186, +0.0821, +0.0053, +0.2737, -0.3057, +0.3035, +0.1323, -0.1751, -0.0723, -0.1592, -0.0189, +0.4940, -0.1320, +0.7386, -0.4053, -0.4595, +0.2891, -0.2814, -0.2732, -0.3878, -0.0508, -0.3031, -0.0900, -0.1481, -0.0295, +0.1081, +0.0118, -0.2671, -0.4238, -0.6124, -0.4290, +0.0999, -0.1606, -0.0520, +0.0625, -0.0631, +0.2304, +0.2005, +0.0601, -0.2944, -0.0609, +0.0028, -0.1674, -0.4267, +0.0795, +0.3197, -0.1282, +0.1888, -0.0881, -0.2824, +0.1609, -0.2738, +0.0080, -0.3420, +0.0118, -0.1805, -0.0695, -0.2148, -0.0442],
[ -0.1461, -0.3083, -0.0136, +0.3491, -0.0290, +0.3424, +0.3128, -0.8923, -0.0311, +0.4562, -0.5008, -0.2628, -0.5347, +0.4261, -0.8726, +0.3809, +0.0750, +0.2290, +0.1609, +0.7750, +0.7054, +0.5667, -0.0308, -0.1819, +0.0820, +0.4682, +0.0067, +0.7634, -0.7444, +0.5989, -0.4113, +0.7116, +0.1244, +0.1147, -0.0071, -0.6724, -0.5993, +0.1626, +0.6093, +0.0538, -0.8576, +0.6754, -0.2876, +0.1336, -0.0715, -1.0126, -0.2272, -0.5580, +0.4600, +0.2445, +0.3166, +0.6317, +0.2138, -0.3606, +0.1187, -0.2267, -0.7156, +0.1361, -0.2859, -0.6256, -0.3897, +0.9252, -0.0776, +0.7848],
[ +0.1464, +0.3072, -0.0388, +0.5124, +0.4801, +0.0987, -0.5256, -0.3276, -0.0263, -0.1081, +0.2124, +0.1791, -0.0333, +0.1428, -0.1281, +0.1435, +0.2712, -0.0514, +0.0850, -0.1852, +0.2707, -0.1793, -0.2719, +0.3596, +0.3184, +0.4565, +0.5516, -0.0501, +0.2197, +0.3126, -0.5817, +0.3559, +0.1426, +0.3172, -0.1160, -0.1692, -0.6272, +0.1959, -0.4451, -0.1134, -0.3743, -0.0713, +0.0393, -0.2958, -0.4315, -0.5926, -0.7838, -0.1594, -0.0710, +0.2824, -0.1254, -0.0887, -0.1983, -0.6687, -0.0528, -0.2886, +0.4150, +0.4496, -0.3273, -0.0736, +0.4142, +0.2092, +0.3307, +0.0986],
[ +0.1252, -0.0804, -0.6313, -0.1442, -0.1409, -0.0495, +0.2679, -0.3541, +0.1423, -0.0939, +0.4240, +0.5037, +0.2610, -0.8900, +0.0978, -0.3720, -0.3362, +0.3375, +0.1250, +0.1657, +0.2272, -0.1980, -0.4005, -0.0867, +0.2113, +0.0430, -0.0368, -0.8812, -0.2031, -0.2549, -0.0015, +0.4324, -0.7663, +0.1556, -0.3059, +0.4959, +0.3042, +0.0977, +0.1135, -0.0805, +0.0440, +0.1244, -0.6298, +0.4727, -0.3854, +0.4377, +0.0456, -0.1188, +0.3324, +0.2114, -0.1295, -0.0819, -0.3557, +0.3933, +0.1743, -0.5287, -0.1305, -0.4580, +0.3473, -0.1871, -0.2655, -0.0570, -0.3614, +0.0310]
])

weights_dense1_b = np.array([ +0.0799, +0.1544, -0.0219, +0.0491, +0.1737, +0.0602, -0.0628, +0.1146, +0.0634, +0.3830, +0.0188, -0.0325, +0.0165, +0.2468, +0.0738, -0.1225, +0.1515, +0.1403, +0.0072, +0.2129, +0.0434, +0.2546, +0.0585, +0.2448, +0.0367, +0.2689, -0.1913, +0.3209, -0.0055, -0.0189, -0.1166, -0.2170, -0.0577, -0.0298, -0.3168, -0.0039, -0.1054, +0.1625, +0.0319, +0.1553, +0.0144, +0.0544, -0.0169, -0.1398, -0.0393, +0.3117, -0.0020, +0.0278, -0.0182, -0.0935, -0.3590, +0.0758, +0.2647, -0.2247, -0.0108, +0.0731, +0.0036, +0.0600, -0.1088, +0.0776, +0.0752, +0.2949, -0.1901, +0.2119])

weights_dense2_w = np.array([
[ +0.2829, +0.1274, +0.0770, +0.0326, +0.3965, +0.2539, -0.0643, -0.0738, -0.0033, +0.1730, +0.0359, -0.0414, +0.3371, +0.3131, -0.0121, -0.1488, -0.2065, +0.1185, -0.3548, +0.0711, -0.0359, -0.0344, +0.1919, -0.0399, +0.1599, -0.0676, +0.1065, -0.1318, +0.0103, +0.1378, -0.0706, -0.1317],
[ +0.0007, +0.0039, -0.0079, -0.0101, +0.0753, +0.0687, +0.1750, -0.0519, +0.1893, -0.1837, +0.1886, -0.2088, +0.2518, -0.0514, -0.0692, +0.2190, +0.1926, +0.0539, -0.2821, +0.1639, +0.3925, +0.0270, +0.1716, -0.1398, +0.0226, +0.1896, +0.1694, +0.2214, +0.3559, -0.7168, +0.2449, -0.0218],
[ -0.0857, -0.3532, +0.1863, -0.3790, +0.2902, -0.3346, +0.0681, -0.1650, -0.2937, +0.0023, +0.1905, +0.1657, -0.4392, +0.0265, +0.0180, -0.1232, +0.1748, -0.0630, -0.0466, -0.3017, +0.1565, +0.2340, -0.0763, +0.5072, -0.3015, -0.1545, +0.1006, -0.1503, +0.0191, +0.1624, -0.1307, -0.3116],
[ -0.2215, -0.2429, +0.0834, -0.0772, -0.1851, +0.2110, -0.0530, +0.3060, +0.1317, +0.0360, -0.1625, +0.1462, +0.0214, +0.3825, -0.3526, -0.1661, -0.0144, -0.0621, +0.1585, -0.2442, +0.1401, -0.0933, -0.1435, -0.1638, +0.1520, -0.1980, -0.1492, -0.0951, -0.0064, -0.2573, +0.1702, +0.0180],
[ -0.1166, +0.0779, +0.0675, -0.0519, -0.0272, -0.1572, +0.0341, -0.1252, +0.0929, +0.0572, +0.0646, +0.1280, +0.3691, +0.0725, -0.0064, +0.1331, -0.1016, +0.2813, -0.1216, +0.2628, +0.0220, -0.0814, -0.0869, -0.2505, +0.1306, -0.2383, -0.4781, +0.3052, +0.0744, -0.1937, +0.1427, -0.1143],
[ -0.0850, -0.2761, -0.0081, +0.0090, +0.1015, -0.5102, -0.0990, -0.1316, -0.2001, +0.2678, -0.0579, +0.1327, -0.2261, +0.1180, +0.0391, -0.0825, +0.2914, -0.2550, +0.0965, -0.1749, +0.0171, -0.0355, -0.1512, -0.0561, +0.0646, -0.3289, +0.2538, -0.0491, +0.2264, -0.2259, +0.2625, -0.0902],
[ +0.2067, -0.0695, +0.1543, +0.2642, -0.0289, -0.0773, -0.1454, +0.2017, -0.0840, -0.4474, -0.0361, +0.1024, -0.4370, +0.0657, +0.2969, +0.3873, +0.1716, +0.0741, -0.0894, +0.2227, -0.1656, -0.4016, +0.0598, -0.2393, -0.1870, -0.0367, +0.3018, +0.0853, +0.2082, -0.1059, +0.1307, -0.0043],
[ +0.0242, +0.0086, -0.2039, +0.0796, +0.1450, +0.0292, -0.0940, -0.3961, -0.0868, -0.1257, -0.0479, +0.0859, +0.1889, -0.2282, +0.2008, +0.2216, +0.0045, -0.1256, +0.2312, +0.0408, -0.1990, -0.0535, +0.0610, +0.1914, +0.1287, -0.2215, -0.1358, +0.2535, -0.6904, +0.1514, -0.5360, +0.0241],
[ -0.3569, -0.0973, -0.1108, -0.0586, -0.2076, -0.0033, -0.1016, +0.0355, +0.3202, -0.2284, +0.4854, -0.2669, +0.0945, +0.1975, -0.1088, +0.2604, +0.2120, +0.3836, -0.4544, -0.1547, -0.0507, -0.3789, -0.3716, -0.0970, -0.0739, +0.0609, +0.0093, +0.1087, +0.0211, -0.0726, +0.1710, -0.1665],
[ +0.4916, +0.1295, +0.0327, +0.2871, +0.0498, +0.1430, -0.2031, +0.1770, +0.0842, -0.1793, -0.0088, +0.1917, +0.0265, +0.1269, -0.0049, -0.3239, -0.0605, +0.1281, +0.1114, +0.2110, +0.2340, -0.3846, +0.0691, -0.2742, +0.1922, +0.3496, -0.1267, +0.0954, +0.1474, -0.2622, +0.1428, +0.1328],
[ +0.2366, -0.1058, +0.0571, +0.3616, +0.1590, -0.0137, +0.1952, +0.1107, -0.0433, +0.0760, -0.1416, +0.0650, +0.3215, -0.0998, -0.0790, -0.0459, +0.2325, +0.0421, +0.1833, +0.1415, -0.0475, -0.2630, +0.2352, +0.0844, +0.0634, +0.0068, -0.2731, +0.2205, +0.0045, -0.2019, +0.0066, +0.0089],
[ -0.2274, -0.1408, +0.0360, -0.1350, +0.0945, -0.0155, -0.1446, +0.2385, -0.2404, -0.2811, +0.1000, +0.1015, -0.2464, +0.0866, -0.1768, +0.5197, -0.0092, -0.3736, +0.2999, -0.2088, -0.0207, +0.0483, -0.2358, -0.0958, -0.5207, +0.2609, +0.0936, +0.0185, +0.2385, +0.2786, -0.0092, +0.4056],
[ -0.0360, +0.1744, -0.1779, -0.1300, +0.3502, +0.0453, -0.2806, -0.1092, -0.2209, +0.2217, -0.2318, +0.1878, +0.0103, -0.0774, +0.1442, +0.0208, +0.1868, +0.0791, +0.0348, +0.0232, -0.2903, -0.1458, -0.0833, -0.0996, +0.0152, +0.0385, +0.0670, +0.1559, -0.2653, +0.1060, -0.2099, -0.2443],
[ -0.0190, +0.3149, +0.1581, +0.0238, -0.3060, -0.0047, +0.0786, -0.0435, +0.0102, -0.0985, +0.3469, +0.1878, +0.0328, +0.0091, -0.1548, +0.1283, +0.0704, +0.0294, -0.2192, +0.0072, +0.0686, +0.1553, +0.2215, +0.0438, +0.3080, -0.0582, +0.3830, -0.2583, +0.1266, -0.1075, +0.0894, -0.2237],
[ +0.1562, -0.2594, +0.1629, -0.3260, +0.5143, -0.1308, +0.0808, -0.0428, -0.1182, +0.1807, -0.1044, -0.0529, -0.3319, -0.0521, -0.0558, +0.1898, +0.0271, -0.1736, -0.1094, +0.1715, -0.2704, +0.2533, +0.0595, +0.1409, +0.3073, +0.0224, -0.4335, +0.2744, -0.1878, +0.1025, -0.1555, -0.0687],
[ -0.2323, -0.0408, -0.0971, -0.2098, -0.0022, -0.4337, -0.1278, -0.0536, -0.2527, +0.1484, -0.1123, +0.2345, -0.1040, -0.3344, +0.0235, +0.0979, +0.4403, +0.0829, +0.2945, -0.0167, -0.2153, +0.1272, -0.0852, +0.0566, +0.1335, -0.2250, -0.2335, -0.1437, +0.0947, -0.1279, +0.1066, -0.0635],
[ -0.2387, -0.2117, -0.1604, -0.2267, -0.0131, +0.3116, -0.0259, +0.2521, +0.0028, -0.1569, -0.2401, +0.0080, +0.4256, -0.1424, -0.1555, -0.2205, +0.0138, +0.1804, -0.1036, +0.2165, +0.0213, -0.2775, +0.1723, +0.1648, -0.1205, +0.0959, -0.1244, +0.1836, +0.3237, +0.1302, +0.1166, -0.1717],
[ +0.3280, +0.0238, +0.1594, -0.2703, -0.1328, -0.3637, +0.0112, -0.0931, -0.0909, -0.0740, -0.1433, -0.0607, -0.1984, -0.1638, +0.0376, +0.0212, +0.0473, +0.3121, -0.2402, -0.0107, -0.0343, -0.0136, +0.0739, -0.0032, -0.1428, -0.4089, +0.0509, -0.3247, +0.0731, +0.0975, +0.1703, -0.4246],
[ -0.2122, -0.0542, +0.1357, +0.0022, -0.0265, +0.3357, +0.1943, -0.0788, -0.1397, -0.1232, +0.2160, +0.1318, +0.0019, +0.0480, -0.1893, -0.2161, +0.2454, -0.1312, +0.2117, +0.0119, -0.2187, -0.3481, +0.1713, -0.2091, -0.3559, +0.3374, -0.1287, +0.0671, -0.1298, -0.1947, -0.0785, +0.0952],
[ -0.0421, +0.2958, -0.4584, +0.5159, -0.1963, -0.0812, -0.1910, +0.2487, +0.1218, -0.1404, +0.3739, -0.0174, +0.2509, +0.3189, +0.1343, +0.0838, -0.2107, +0.1989, -0.1778, +0.0613, +0.0533, -0.3126, +0.0413, -0.2011, +0.2419, +0.0899, -0.2697, -0.3448, +0.0357, -0.4831, +0.1735, +0.2227],
[ -0.0521, -0.1595, -0.0601, +0.2155, +0.0070, +0.1074, -0.1234, +0.1599, +0.1795, +0.0954, +0.0160, -0.0574, +0.1454, -0.0241, -0.0995, +0.0168, +0.0644, +0.0537, +0.0937, +0.0684, +0.3049, +0.0745, -0.0710, -0.6067, +0.1349, +0.1707, -0.2863, +0.0280, +0.2832, -0.2647, +0.2071, +0.1057],
[ -0.0478, -0.5939, -0.1217, -0.1405, +0.0689, -0.0133, -0.0020, +0.2720, +0.1148, -0.2586, +0.0656, -0.0397, +0.0449, +0.1041, -0.2168, +0.2907, -0.0294, +0.0605, +0.2430, -0.0271, +0.2530, -0.1369, +0.2640, -0.0372, -0.0641, +0.1885, +0.1305, -0.1112, +0.0950, -0.1688, -0.0757, -0.0659],
[ -0.1806, +0.1548, -0.0017, +0.3349, -0.1857, +0.0800, +0.1847, +0.1074, +0.0742, -0.0163, +0.2422, -0.0903, +0.1342, +0.2944, -0.2535, -0.1271, +0.1074, -0.5867, +0.3454, -0.2476, +0.3622, +0.0892, +0.0699, -0.2643, +0.1975, -0.2715, +0.4037, +0.0580, -0.1330, -0.0576, +0.1185, +0.3701],
[ +0.0218, +0.1055, -0.0118, -0.0027, -0.1094, +0.0474, -0.1542, +0.0609, +0.0428, -0.1108, +0.2926, +0.2620, +0.0211, -0.0613, +0.1070, +0.0523, +0.0682, -0.1718, -0.0819, +0.2531, +0.2900, -0.0411, +0.0239, -0.5966, +0.0824, -0.1774, -0.0764, +0.2194, +0.0444, +0.0861, +0.0137, +0.0431],
[ +0.0469, -0.0792, -0.1053, +0.0590, -0.1526, +0.1578, +0.0487, -0.1142, +0.1971, +0.3255, +0.4005, -0.0093, -0.2488, -0.0013, +0.0281, +0.1407, -0.0120, -0.1971, -0.1437, -0.2330, +0.1525, -0.1870, +0.1630, +0.1598, +0.1093, +0.3150, -0.0224, -0.0575, +0.0857, +0.0641, +0.2839, +0.0183],
[ -0.0784, +0.0791, +0.4809, -0.1248, -0.0989, +0.1052, -0.3433, +0.2690, +0.0168, +0.3452, -0.3863, +0.0751, -0.3925, +0.0107, +0.1768, -0.0807, +0.2579, -0.0265, +0.2487, -0.0629, +0.0129, +0.2844, -0.3485, +0.1829, +0.0740, +0.0677, +0.3566, -0.3349, +0.0599, -0.3058, +0.1419, +0.0882],
[ -0.0937, -0.2743, +0.0906, -0.0508, -0.0865, +0.1717, -0.2055, +0.1127, +0.0357, +0.1230, -0.1609, +0.1943, -0.1273, -0.0955, +0.1452, -0.0981, -0.0791, -0.4413, +0.0881, -0.0929, +0.2639, +0.1218, -0.1424, -0.2671, -0.4229, -0.2542, +0.1076, +0.0447, +0.0384, -0.1924, +0.0847, +0.0723],
[ +0.0396, +0.0678, +0.0898, +0.3115, -0.5523, +0.1503, -0.0894, +0.2095, +0.6246, -0.3651, +0.3281, +0.0196, -0.0622, +0.3541, -0.3035, -0.0404, -0.0118, -0.3145, +0.4883, -0.3125, +0.4076, -0.2360, -0.1495, +0.0301, +0.3403, +0.0244, +0.0775, -0.1366, +0.1018, -0.4915, +0.1281, +0.1915],
[ +0.1467, +0.1486, +0.2974, +0.2949, -0.0269, -0.0640, +0.2443, -0.2571, -0.0663, +0.0175, -0.1866, -0.0092, +0.0048, -0.1436, -0.4454, +0.0481, +0.0889, -0.1543, +0.4118, -0.0814, -0.1840, +0.1255, +0.4842, +0.0348, -0.2321, -0.1215, +0.1285, +0.3067, -0.0888, +0.0178, -0.2954, +0.1835],
[ -0.0847, +0.0338, +0.2585, -0.0346, -0.0649, +0.0321, -0.2943, +0.0240, -0.3300, -0.4084, +0.0111, +0.0048, +0.1627, -0.0849, +0.2638, -0.3748, +0.0415, +0.1422, -0.4196, +0.1417, +0.0146, +0.2250, -0.0452, +0.0423, +0.1624, -0.0954, -0.0580, -0.0004, -0.4046, +0.4264, -0.0812, +0.2286],
[ +0.1782, -0.4812, +0.1321, -0.1112, -0.1532, +0.2046, -0.3722, +0.0942, +0.1493, -0.1924, -0.0744, -0.2355, -0.0612, +0.0706, +0.0720, +0.3954, -0.1152, +0.2877, -0.3304, +0.0313, -0.2829, +0.1351, -0.3389, +0.2455, -0.0903, -0.1800, -0.1948, -0.0064, -0.4042, +0.2186, -0.2553, +0.1482],
[ +0.0040, -0.1684, +0.0496, +0.1741, -0.2362, -0.0376, -0.0380, -0.1089, +0.0411, -0.3712, +0.0059, +0.1112, -0.2294, -0.0793, +0.4566, -0.0478, -0.0587, -0.0894, +0.0454, -0.2894, +0.2033, -0.0227, -0.7314, -0.2293, -0.0700, -0.3334, +0.3382, -0.0348, -0.0905, -0.2208, -0.0810, -0.0063],
[ +0.0747, -0.0217, -0.0092, +0.0114, +0.0480, +0.0900, +0.1192, -0.1617, +0.2004, -0.0154, -0.1660, +0.0561, -0.0440, -0.0220, -0.2711, -0.0894, +0.0784, +0.0973, -0.0428, +0.1328, -0.1659, +0.2542, +0.1264, +0.2223, -0.2180, -0.1995, -0.1626, +0.0245, -0.0984, -0.3480, +0.1050, +0.0935],
[ +0.0287, -0.1099, +0.2528, +0.0162, -0.0995, +0.0518, -0.2633, +0.0000, +0.2565, +0.0351, -0.0870, -0.0902, +0.0149, +0.0973, +0.2342, +0.1039, -0.1725, -0.2721, -0.0824, +0.0831, +0.0405, -0.3939, -0.0622, -0.5813, -0.1100, +0.2711, -0.2749, -0.2576, +0.0073, +0.4134, +0.1809, +0.2133],
[ -0.1252, +0.1549, -0.1616, -0.2720, +0.2079, +0.0715, +0.0903, -0.2062, -0.0209, +0.1867, +0.0670, +0.0431, -0.4566, +0.1257, +0.0873, -0.0011, +0.2216, +0.0357, +0.3581, +0.0084, -0.2142, -0.0152, +0.1803, -0.7305, -0.4258, +0.3227, -0.1614, -0.1410, +0.1404, -0.2543, +0.1621, +0.4313],
[ +0.1104, +0.0768, -0.1205, -0.1728, +0.4868, -0.1588, +0.1403, -0.3541, -0.3945, +0.2283, -0.2076, +0.2584, -0.1624, -0.3239, -0.1746, -0.3207, +0.1709, -0.0781, -0.1771, +0.0422, -0.3754, +0.2854, +0.1947, -0.4934, -0.4157, +0.1719, -0.1314, +0.3175, -0.0652, +0.1482, -0.2112, -0.0567],
[ +0.1508, +0.2565, +0.2537, -0.0286, -0.1716, +0.0498, +0.0160, -0.5214, +0.0666, +0.2215, -0.1799, -0.0214, -0.1626, +0.1637, -0.1308, +0.3074, -0.0241, +0.0377, -0.1874, +0.0508, -0.1862, -0.5354, -0.0691, +0.2496, +0.0845, -0.2812, +0.0761, -0.0841, -0.0833, +0.4389, -0.0549, +0.0776],
[ -0.1714, -0.0352, +0.0266, -0.3822, +0.0337, +0.1164, -0.1764, +0.4583, -0.0036, -0.0347, +0.2586, +0.0722, -0.3488, +0.2185, -0.1926, -0.1549, -0.1787, -0.1909, -0.1000, -0.3061, +0.2345, -0.0593, -0.0374, -0.3058, -0.0080, +0.2983, +0.2218, +0.0767, +0.1498, +0.0858, +0.3744, +0.0096],
[ -0.2420, -0.0554, +0.2195, +0.0307, -0.2940, +0.1872, +0.0618, +0.2659, +0.2339, -0.3291, +0.1386, +0.1001, +0.0347, +0.1362, +0.2688, +0.0226, +0.0682, -0.0121, +0.1918, +0.2568, +0.1141, -0.1025, -0.0338, -0.1298, +0.1924, +0.1906, -0.1686, -0.1671, +0.2924, -0.2632, +0.0501, +0.0405],
[ +0.1252, +0.0812, -0.0849, +0.0270, -0.0002, -0.4768, +0.2010, -0.0171, -0.1460, -0.4890, -0.0724, +0.2979, -0.0225, +0.0561, +0.0556, -0.1974, +0.2168, -0.0812, -0.3776, +0.0030, -0.2469, -0.0352, -0.0367, +0.0420, +0.0320, -0.3297, -0.0107, +0.1357, -0.1182, -0.0626, -0.0425, -0.1379],
[ -0.1907, -0.1556, +0.0739, -0.0764, +0.1463, +0.2185, +0.2552, +0.0752, -0.2591, +0.1960, -0.1504, +0.4060, -0.1040, +0.0203, -0.1230, +0.0972, +0.1126, -0.3697, +0.3378, +0.1409, -0.3265, +0.3099, +0.1802, +0.3556, -0.2254, +0.3623, +0.2445, -0.1138, -0.4321, +0.0207, -0.3463, -0.0093],
[ +0.0096, -0.0866, -0.2822, -0.0927, +0.2068, -0.3553, -0.1579, +0.1594, -0.3071, +0.1631, -0.1246, +0.0938, -0.0004, +0.0840, +0.1463, -0.1558, +0.2340, +0.3257, -0.3991, +0.0515, -0.1567, +0.2290, +0.1188, -0.3040, -0.1813, -0.0153, +0.0244, +0.1772, +0.0349, +0.1587, -0.1103, -0.5543],
[ -0.0915, +0.1176, -0.0099, +0.3227, -0.0469, +0.1838, -0.3002, -0.1755, +0.0676, +0.2483, +0.3218, +0.1283, +0.2370, +0.1768, +0.2354, -0.0386, -0.0949, -0.0928, +0.1924, +0.1165, +0.1604, -0.1646, -0.1606, +0.3827, +0.1940, -0.1017, -0.1261, +0.1428, -0.0082, +0.0580, +0.1718, +0.2130],
[ -0.3111, +0.0622, +0.0064, -0.1889, +0.0499, -0.2819, +0.1671, +0.0604, -0.2524, -0.0695, +0.0384, +0.1589, -0.1238, -0.0963, +0.3746, -0.0018, -0.0663, -0.0101, +0.3958, -0.2887, +0.1974, -0.2779, +0.2408, -0.2100, +0.1432, -0.0702, +0.5127, -0.1024, +0.0199, -0.1238, -0.2157, +0.1254],
[ -0.2472, +0.2093, -0.5888, -0.1486, +0.0574, -0.1031, +0.0812, -0.0544, +0.1832, -0.2564, +0.0849, +0.0801, -0.0786, -0.2510, +0.1087, +0.2753, -0.0871, +0.1333, +0.1997, +0.0729, +0.0498, +0.2650, -0.0388, +0.2703, +0.1722, -0.0245, -0.1956, -0.0113, -0.1350, +0.0302, -0.0595, +0.2341],
[ -0.2441, +0.3174, -0.2730, +0.2413, +0.3269, -0.4280, +0.1572, -0.3127, -0.2926, -0.0215, -0.3552, +0.1957, +0.0137, -0.6220, +0.1319, +0.0829, -0.0049, -0.0443, -0.1172, +0.3053, -0.3735, +0.1112, -0.0780, +0.1814, +0.0960, -0.0811, -0.0196, +0.2492, -0.6042, +0.2134, -0.6778, -0.0084],
[ +0.0565, +0.1218, +0.0181, -0.0834, +0.0192, +0.0598, +0.2315, -0.1048, +0.2831, +0.1979, -0.2692, -0.0116, -0.1692, -0.4723, +0.0826, +0.0496, +0.2443, +0.2131, +0.3430, +0.3428, -0.0581, -0.2363, -0.0521, +0.1940, +0.0545, -0.0787, +0.2059, -0.0810, +0.0064, +0.3821, -0.4971, -0.1395],
[ +0.1839, -0.1342, +0.0192, +0.0195, +0.1666, -0.2863, +0.2493, -0.3058, -0.1050, +0.0705, -0.2060, +0.2653, -0.2547, -0.2785, -0.0522, -0.2075, +0.1909, +0.0249, -0.0408, +0.0522, -0.1604, -0.1123, +0.0775, +0.0816, -0.3413, -0.3856, +0.1994, +0.3341, -0.2176, +0.1241, -0.3368, -0.2072],
[ -0.0567, -0.0593, -0.0702, +0.3314, -0.1736, -0.2123, +0.1194, -0.0399, +0.2493, +0.0957, +0.1531, +0.1867, +0.3614, +0.0116, -0.0446, +0.0644, +0.1170, -0.1874, +0.0825, +0.0555, +0.1033, -0.0896, -0.2112, -0.8902, -0.0802, +0.0675, -0.0263, -0.0992, +0.1519, +0.0378, +0.2805, +0.4746],
[ -0.3438, +0.0810, +0.0194, +0.1449, +0.1512, +0.0073, -0.5117, -0.2109, -0.2282, -0.5956, +0.1387, -0.0704, -0.0214, -0.2205, +0.3680, +0.1036, +0.0742, +0.1049, -0.2188, +0.0580, -0.2253, +0.2587, -0.7255, +0.5316, +0.0336, +0.3382, +0.2498, -0.2561, -0.2473, +0.1051, -0.1320, -0.1386],
[ -0.0613, +0.1346, -0.0849, +0.0698, -0.4736, -0.1602, +0.2476, -0.2880, -0.0583, -0.2253, -0.0811, +0.0257, +0.0918, +0.2408, -0.0562, +0.0289, -0.0754, +0.1165, -0.1366, -0.2964, +0.0276, -0.1623, +0.1237, +0.2697, -0.4742, +0.0046, -0.1642, -0.0174, -0.0927, -0.3042, -0.0466, +0.4001],
[ -0.0133, -0.2633, -0.0222, -0.0470, -0.1426, -0.1825, +0.3973, +0.1082, +0.0472, +0.0463, +0.1395, +0.1672, -0.4916, +0.2919, -0.0058, -0.2578, +0.2675, -0.0605, +0.4374, -0.0772, +0.2279, -0.1046, -0.0228, -0.0861, -0.0378, +0.0290, +0.2521, -0.1899, +0.1253, -0.1489, +0.0663, +0.2189],
[ -0.0772, +0.0547, -0.1025, +0.0742, +0.0579, -0.0822, +0.0547, +0.0928, +0.3128, -0.7244, -0.0546, +0.0405, +0.2536, -0.0947, -0.2049, -0.1462, -0.0205, +0.2566, +0.1919, +0.2206, +0.1480, +0.0772, +0.0347, -0.3676, +0.3167, +0.1508, +0.0602, -0.0956, -0.0635, +0.0679, +0.2738, -0.1655],
[ -0.0089, -0.1972, +0.3011, -0.2190, +0.0261, -0.2587, +0.0892, -0.0625, -0.1996, +0.2813, +0.0026, +0.3962, +0.1465, +0.0207, +0.4603, +0.2336, +0.0307, -0.3998, +0.1829, +0.0044, -0.1982, +0.1740, -0.2629, +0.1894, +0.2644, -0.3220, +0.1762, -0.1777, -0.0815, +0.2274, -0.2811, -0.1195],
[ -0.0111, +0.0012, -0.2570, +0.0068, -0.1398, -0.0442, +0.1081, +0.5332, +0.0497, -0.0386, -0.0705, -0.2804, +0.3541, +0.1675, -0.0679, +0.0024, -0.1482, -0.2235, -0.0644, +0.1055, +0.1669, +0.0143, +0.0969, -0.3484, -0.0541, -0.2003, -0.3946, -0.0202, +0.3514, +0.1176, +0.1615, +0.0149],
[ +0.0024, +0.0249, +0.2366, -0.1528, +0.1546, -0.4135, -0.1059, +0.0903, +0.1755, -0.3064, -0.3129, +0.1606, +0.1677, -0.0400, -0.0257, +0.0413, +0.0561, +0.1476, +0.0935, +0.1599, -0.0345, -0.1886, +0.0270, +0.1870, +0.1104, -0.0194, +0.1017, +0.0461, -0.0919, +0.1252, +0.1206, -0.0130],
[ -0.0526, +0.0546, -0.1009, -0.1725, +0.2763, +0.0659, +0.2463, -0.2004, -0.3565, +0.2246, -0.1045, +0.1825, -0.3300, -0.3094, -0.1888, -0.2640, +0.5332, +0.0568, +0.0475, +0.0745, -0.1725, +0.1485, +0.3252, +0.1078, -0.1331, +0.1344, -0.2358, +0.2692, -0.0565, +0.0090, -0.3554, +0.1742],
[ -0.3926, +0.0214, -0.0443, -0.7474, -0.0188, +0.1542, +0.1163, +0.1252, -0.1733, +0.0703, +0.0087, +0.3004, -0.1396, +0.3037, -0.2343, +0.0954, +0.0832, -0.0768, +0.2065, -0.1849, +0.1115, +0.1196, -0.0546, +0.1821, +0.1369, -0.1144, +0.4551, -0.0353, +0.0586, -0.1398, +0.3542, +0.3121],
[ +0.0512, -0.1070, -0.4577, +0.0465, -0.0348, -0.1299, -0.0087, -0.2569, -0.2728, +0.1693, -0.0839, -0.0948, +0.1583, -0.1115, +0.3025, +0.0486, +0.2706, -0.3122, -0.0527, +0.1545, -0.2488, +0.0513, +0.0882, -0.2772, -0.1576, -0.1341, -0.2886, +0.2118, +0.0039, -0.0393, -0.1096, -0.0538],
[ -0.1762, +0.2818, -0.1677, -0.1747, -0.0392, +0.3854, +0.4221, -0.3216, -0.4693, -0.0617, -0.0296, +0.1388, +0.2471, -0.2084, -0.0341, -0.0501, +0.2539, -0.1444, +0.2168, +0.0050, -0.5135, +0.7831, +0.0541, -0.0698, +0.0817, +0.0589, +0.1087, +0.0429, -0.5212, +0.3620, -0.5175, -0.2442],
[ +0.1872, +0.1264, +0.0304, -0.5090, +0.2515, +0.1082, -0.0478, -0.2074, -0.0752, +0.0883, -0.0211, +0.2488, -0.1946, -0.0406, -0.0819, +0.1379, +0.1371, +0.2168, -0.2324, -0.1298, -0.1645, +0.1328, -0.0107, -0.0304, +0.0185, -0.3438, +0.1127, -0.1885, +0.0912, -0.0451, -0.3027, -0.1258],
[ +0.1804, +0.2549, +0.2666, +0.0777, -0.2163, -0.0253, -0.4566, +0.1145, +0.0411, -0.1807, +0.1224, -0.0022, +0.0518, +0.0738, +0.4896, +0.1047, +0.2574, -0.1460, -0.1439, -0.1068, +0.2620, -0.1485, -0.4162, -0.1776, +0.2563, +0.1715, -0.0329, -0.2095, +0.1647, +0.3084, +0.1936, +0.0287],
[ +0.4312, +0.1454, +0.2662, -0.2998, +0.0080, +0.0861, -0.3425, +0.2405, +0.0726, +0.2038, -0.0252, -0.1227, +0.1526, +0.0350, +0.2042, +0.2369, -0.1322, -0.1090, -0.2683, +0.5445, -0.1575, +0.0954, +0.1289, +0.1190, +0.0980, +0.0501, -0.2363, +0.1156, -0.1976, -0.2151, +0.1241, +0.0866],
[ +0.5668, -0.1841, +0.0680, +0.0811, -0.5151, +0.0804, -0.5132, +0.1044, -0.0942, -0.2706, +0.1516, -0.0667, -0.2792, +0.3116, +0.0538, -0.0620, -0.0580, -0.0752, +0.1782, -0.1050, +0.3424, -0.0788, -0.1616, -0.2246, +0.1611, +0.2062, -0.0285, -0.4489, +0.3289, +0.1713, -0.1071, -0.0225]
])

weights_dense2_b = np.array([ +0.1355, +0.2092, +0.0662, +0.0571, +0.1510, +0.0876, +0.0767, +0.1725, +0.0316, +0.0244, +0.0061, +0.1714, +0.0993, +0.0420, -0.1015, +0.0057, +0.1259, +0.0470, +0.0253, +0.1994, +0.1933, +0.1444, +0.0794, +0.0035, +0.1838, +0.0697, +0.1407, +0.0796, +0.1491, -0.0828, +0.1767, -0.1738])

weights_final_w = np.array([
[ -0.3632, -0.0928],
[ -0.1530, -0.3364],
[ +0.0840, +0.2019],
[ -0.5693, +0.0923],
[ -0.3316, -0.3358],
[ -0.1430, +0.2761],
[ +0.0627, -0.2931],
[ -0.2700, +0.4356],
[ -0.1396, +0.3754],
[ -0.4312, -0.2885],
[ +0.2022, +0.3984],
[ +0.0979, -0.1770],
[ -0.2544, -0.3154],
[ +0.1200, +0.3533],
[ +0.2107, -0.2887],
[ +0.0358, +0.3919],
[ +0.0660, -0.1379],
[ -0.1495, -0.2808],
[ +0.4709, -0.1830],
[ -0.2473, -0.1786],
[ +0.0928, +0.4902],
[ -0.0420, -0.4526],
[ -0.0682, -0.4276],
[ +0.1406, +0.5637],
[ -0.5923, +0.0503],
[ -0.3084, +0.4245],
[ +0.4819, -0.0185],
[ -0.1724, -0.1454],
[ -0.0248, +0.3343],
[ -0.2483, +0.6624],
[ -0.0615, +0.3794],
[ +0.3452, +0.1801]
])

weights_final_b = np.array([ -0.0066, -0.1176])

if __name__=="__main__":
    demo_run()
